<!DOCTYPE html>
<html>
<head>
  <meta charset="UTF-8">
  <title>VSCODE</title>
</head>
<body>


<h1>【golang下载】</h1>

<p><a href="https://golang.google.cn/dl/">https://golang.google.cn/dl/</a></p>

<h1>【VS CODE】</h1>  

<h3>[官方下载]</h3>

<p><a href="https://code.visualstudio.com/Download">https://code.visualstudio.com/Download</a></p>

<h3>[加速下载]</h3>

<p>复制下载任务的地址,如<code style="background-color: #f1f1f1;">https://az764295.vo.msecnd.net/stable/74f6148eb9ea00507ec113ec51c489d6ffb4b771/VSCodeUserSetup-x64-1.80.1.exe</code></p>

<p>替换域名为:<code style="background-color: #f1f1f1;">vscode.cdn.azure.cn</code></p> 

<p>结果:<code style="background-color: #f1f1f1;">https://vscode.cdn.azure.cn/stable/74f6148eb9ea00507ec113ec51c489d6ffb4b771/VSCodeUserSetup-x64-1.80.1.exe</code></p>

<p>教程:<a href="https://blog.csdn.net/z099164/article/details/131396783"><code style="background-color: #f1f1f1;">https://blog.csdn.net/z099164/article/details/131396783</code></a></p>

<h3>[设为中文]</h3>

<p>扩展商店搜 <code style="background-color: #f1f1f1;">chinese</code> 安装</p> 

<p>教程:<a href="https://jingyan.baidu.com/article/64d05a023e7a479f54f73b03.html"><code style="background-color: #f1f1f1;">https://jingyan.baidu.com/article/64d05a023e7a479f54f73b03.html</code></a></p>

<h3>[翻译插件]</h3>

<p>扩展商店搜 <code style="background-color: #f1f1f1;">Exclusive Translation</code> 安装</p>

<p>详情:<a href="https://marketplace.visualstudio.com/items?itemName=chenchao.exclusive-translation"><code style="background-color: #f1f1f1;">https://marketplace.visualstudio.com/items?itemName=chenchao.exclusive-translation</code></a></p>

<h3>[AI 插件]</h3>  

<p>扩展商店搜 <code style="background-color: #f1f1f1;">codegeex</code> 安装</p>

<p>详情:<a href="https://codegeex.cn/zh-CN"><code style="background-color: #f1f1f1;">https://codegeex.cn/zh-CN</code></a></p>

<p>Github:</p>

<p><a href="https://github.com/THUDM/CodeGeeX"><code style="background-color: #f1f1f1;">https://github.com/THUDM/CodeGeeX</code></a></p>

<p><a href="https://github.com/THUDM/CodeGeeX2"><code style="background-color: #f1f1f1;">https://github.com/THUDM/CodeGeeX2</code></a></p>

<h1>【Go模块代理】</h1>

<p><a href="https://goproxy.cn/">https://goproxy.cn/</a></p>

<p><a href="https://proxy.golang.com.cn/zh/">https://proxy.golang.com.cn/zh/</a></p>

<h3>【设置代理】</h3>

<p>[对于Windows PowerShell]</p> 

<pre><code style="background-color: #f1f1f1;">$env:GO111MODULE = "on"  

$env:GOPROXY = "https://goproxy.cn"</code></pre>

<p>[对于Windows命令提示符]</p>

<pre><code style="background-color: #f1f1f1;">setx GO111MODULE "on"

setx GOPROXY "https://goproxy.cn"</code></pre>

<h3>【验证代理】</h3>  

<p>[对于Windows PowerShell]</p>

<pre><code style="background-color: #f1f1f1;">echo $env:GO111MODULE  

echo $env:GOPROXY</code></pre>

<p>[对于Windows命令提示符]</p>

<pre><code style="background-color: #f1f1f1;">echo %GO111MODULE%

echo %GOPROXY%</code></pre>

<p>如果输出结果为 <code style="background-color: #f1f1f1;">on</code> 和 <code style="background-color: #f1f1f1;">https://goproxy.cn</code> ,则说明环境变量设置成功。</p>

<h1>【报错】安装模块</h1>

<p>如VSCODE安装模块报错:</p>

<p><code style="background-color: #f1f1f1;">go: could not create module cache: mkdir C:\xxxx\xxxx\go: The system cannot find the path specified.</code></p>

<p>(无法创建模块缓存目录)</p>

<h3>1.创建</h3>

<p>[对于Windows PowerShell]</p>

<pre><code style="background-color: #f1f1f1;">mkdir $env:USERPROFILE\go</code></pre>

<p>[对于Windows命令提示符]</p>

<pre><code style="background-color: #f1f1f1;">mkdir %USERPROFILE%\go</code></pre>

<h3>2.验证</h3>

<p>[对于Windows PowerShell]</p> 

<pre><code style="background-color: #f1f1f1;">dir $env:USERPROFILE\go</code></pre>

<p>[对于Windows命令提示符]</p>

<pre><code style="background-color: #f1f1f1;">dir %USERPROFILE%\go</code></pre>

<h1>【报错】运行调试</h1>

<p>如VSCODE运行调试报错:</p>

<p><code style="background-color: #f1f1f1;">go: go.mod file not found in current directory or any parent directory; see 'go help modules' (exit status 1)</code></p>

<p>cd到项目目录</p>

<pre><code style="background-color: #f1f1f1;">cd c:\go\test</code></pre>

<p>初始化</p> 

<pre><code style="background-color: #f1f1f1;">go mod init</code></pre>

<p>报错:</p>

<p><code style="background-color: #f1f1f1;">go: cannot determine module path for source directory c:\go\test (outside GOPATH, module path must be specified)</code></p>

<p>重新初始化,ProjectName为项目名称可自定义</p>

<pre><code style="background-color: #f1f1f1;">go mod init ProjectName</code></pre>

<p>成功:</p>

<p><code style="background-color: #f1f1f1;">go: creating new go.mod: module ProjectName</code></p>

<p>源码目录下会生成 <code style="background-color: #f1f1f1;">go.mod</code> 文件</p>


</body>  
</html> 